import { PageResult } from '@/typings/page'
import { WmMaterialItem, WmMaterialParams } from '@/typings/wmMaterial'
import request from '@/utils/http'

export class WmMaterialService {
  /**
   * 文章素材列表
   * @param params
   * @returns
   */
  static async getMaterialList(params: WmMaterialParams) {
    return request.request<PageResult<WmMaterialItem>>({
      url: '/wemedia/material/list',
      method: 'get',
      params
    })
  }

  /**
   * 收藏文章素材
   * @param id 文章素材id
   * @returns
   */
  static async collectMaterial(id: number) {
    return request.request({
      url: '/wemedia/material/collect?id=' + id,
      method: 'put'
    })
  }

  /**
   * 删除文章素材
   * @param id
   * @returns
   */
  static async deleteMaterial(id: number) {
    return request.request({
      url: '/wemedia/material/del?id=' + id,
      method: 'delete'
    })
  }
}
